package com.anlogic.sdk.linker;

public class Memory {
	public static final String PROPERTY_NAME = "Name";

	public static final String PROPERTY_BASE = "Base Address";

	public static final String PROPERTY_SIZE = "Size";

	public static final String[] PROPERTIES = new String[] { "Name", "Base Address", "Size" };

	private String oldName;
	
	private String name;
	
	private String aliasName;

	private String base;

	private String size;
	
	private String attr;

	public Memory(String name, String base, String size) {
		this.oldName = name;
		this.name = name;
		this.base = base;
		this.size = size;
	}

	public String getOldName() {
		if (this.oldName == null)
			return "unknown";
		return this.oldName;
	}
	
	public String getName() {
		if (this.name == null)
			return "unknown";
		return this.name;
	}
	
	public String getAliasName() {
		if (this.aliasName == null)
			return "unknown";
		return this.aliasName;
	}
	
	public String getRealName() {
		if (!getAliasName().equals("unknown"))
			return getAliasName();
		return getName();
	}

	public String getBase() {
		if (this.base == null)
			return "unknown";
		return this.base;
	}

	public String getSize() {
		if (this.size == null)
			return "unknown";
		return this.size;
	}

	public String getAttr() {
		if (this.attr == null)
			return "unknown";
		return this.attr;
	}

	public void setOldName(String value) {
		this.oldName = value;
	}

	public void setName(String value) {
		this.name = value;
	}
	
	public void setAliasName(String value) {
		this.aliasName = value;
	}
	
	public void setRealName(String value) {
		if (!getAliasName().equals("unknown")) {
			setAliasName(value);
		} else {
			setName(value);
		}
	}

	public void setBase(String value) {
		this.base = value;
	}

	public void setSize(String value) {
		this.size = value;
	}
	
	public void setAttr(String value) {
		this.attr = value;
	}
}